package com.ui.basic.ibatis.dao.system;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.ui.basic.ibatis.model.system.TblSRole;
import com.ui.basic.ibatis.model.system.TblSRoleExample;

@Repository("tblSRoleDAO")
public class TblSRoleDAOImpl implements TblSRoleDAO {
    /**
     * This field was generated by Apache iBATIS ibator.
     * This field corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    @Autowired private SqlMapClient sqlMapClient;

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public TblSRoleDAOImpl() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public void setSqlMapClient(SqlMapClient sqlMapClient) {
        this.sqlMapClient = sqlMapClient;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public SqlMapClient getSqlMapClient() {
        return sqlMapClient;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int countByExample(TblSRoleExample example) throws SQLException {
        Integer count = (Integer)  sqlMapClient.queryForObject("tbl_s_role.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int deleteByExample(TblSRoleExample example) throws SQLException {
        int rows = sqlMapClient.delete("tbl_s_role.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int deleteByPrimaryKey(Long id) throws SQLException {
        TblSRole key = new TblSRole();
        key.setId(id);
        int rows = sqlMapClient.delete("tbl_s_role.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public void insert(TblSRole record) throws SQLException {
        sqlMapClient.insert("tbl_s_role.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public void insertSelective(TblSRole record) throws SQLException {
        sqlMapClient.insert("tbl_s_role.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    @SuppressWarnings("unchecked")
    public List<TblSRole> selectByExample(TblSRoleExample example) throws SQLException {
        List<TblSRole> list = sqlMapClient.queryForList("tbl_s_role.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public TblSRole selectByPrimaryKey(Long id) throws SQLException {
        TblSRole key = new TblSRole();
        key.setId(id);
        TblSRole record = (TblSRole) sqlMapClient.queryForObject("tbl_s_role.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int updateByExampleSelective(TblSRole record, TblSRoleExample example) throws SQLException {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = sqlMapClient.update("tbl_s_role.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int updateByExample(TblSRole record, TblSRoleExample example) throws SQLException {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = sqlMapClient.update("tbl_s_role.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int updateByPrimaryKeySelective(TblSRole record) throws SQLException {
        int rows = sqlMapClient.update("tbl_s_role.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    public int updateByPrimaryKey(TblSRole record) throws SQLException {
        int rows = sqlMapClient.update("tbl_s_role.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table tbl_s_role
     *
     * @ibatorgenerated Sun Jun 07 00:19:20 ICT 2009
     */
    private static class UpdateByExampleParms extends TblSRoleExample {
        private Object record;

        public UpdateByExampleParms(Object record, TblSRoleExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}